function inPassword( v ){
    for (let i = 0; i < v.value.length; i++) {
        v.value = v.value.replace(/[^0-9a-zA-Z_-]/,"")
    }
}

function inText( v ){
    for (let i = 0; i < v.value.length; i++) {
        v.value = v.value.replace(/[\W]/, '')
    }
}

function inNumber(v) {
    for (let i = 0; i < v.value.length; i++) {
        v.value = v.value.replace(/[\D]/, '')
    }
}

function getUrlParam( key ){
    var url = document.location.toString();//获取url地址
    var urlParmStr = url.slice(url.indexOf('?')+1);//获取问号后所有的字符串
    var arr = urlParmStr.split('&');//通过&符号将字符串分割转成数组
    for (let val of arr) {
        let ta = val.split("=")
        if(  ta[0] == key ){
            return decodeURI(ta[1])
        }
    }
}

function toDate(obj) {
    //日期转yyyy-MM-dd
    var date = new Date(obj)
    var fullYear = date.getFullYear();

    var month = date.getMonth() + 1;

    var _date = date.getDate();

    var hours = date.getHours();

    var minutes = date.getMinutes();

    var seconds = date.getSeconds();

    if(month < 10){month = '0'+month}

    if(_date < 10){_date = '0'+_date}

    if(hours < 10){hours = '0'+hours}

    if(minutes < 10){minutes = '0'+minutes}

    if(seconds < 10){seconds = '0'+seconds}

    Str=fullYear + '-' + month + '-' + _date + ' ' + hours + ':' + minutes + ':' + seconds

    return Str;
}